package com.koron.housing.info.bean.po;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.koron.bean.base.BaseBean;
import com.koron.common.core.util.StringUtils;
import com.koron.housing.excel.HousingInfoConvertor;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

/**
 * 房源台账(HousingInfo)表实体类
 *
 * @author jzp
 * @since 2022-02-25
 */
@ExcelIgnoreUnannotated
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel(value = "房源台账", description = "HousingInfo")
public class HousingInfo extends BaseBean {

    /**
     * 标题
     */
    @ApiModelProperty("标题")
    private String title;

    /**
     * 地址
     */
    @ExcelProperty(value = "地址", index = 3)
    @ApiModelProperty("地址")
    private String address;

    /**
     * 经度
     */
    @ApiModelProperty("经度")
    private String longitude;

    /**
     * 纬度
     */
    @ApiModelProperty("纬度")
    private String latitude;

    /**
     * 小区
     */
    @ExcelProperty(value = "小区", index = 4)
    @ApiModelProperty("小区")
    private String village;

    /**
     * 房号
     */
    @ExcelProperty(value = "房号", index = 5)
    @ApiModelProperty("房号")
    private String roomNum;

    /**
     * 合同id
     */
    @ApiModelProperty("合同id")
    private String contractId;

    /**
     * 合同编号
     */
    @ApiModelProperty("合同编号")
    private String contractCode;

    /**
     * 物业来源，housing_property_source
     */
    @ExcelProperty(value = "物业来源", index = 1, converter = HousingInfoConvertor.class)
    @ApiModelProperty("物业来源，housing_property_source")
    private String propertySource;

    /**
     * 使用类型，housing_a_usage_type人才房、housing_b_usage_type公司自有
     */
    @ExcelProperty(value = "使用类型", index = 2, converter = HousingInfoConvertor.class)
    @ApiModelProperty("使用类型，housing_a_usage_type人才房、housing_b_usage_type公司自有")
    private String usageType;

    /**
     * 房屋类型，housing_type
     */
    @ApiModelProperty("房屋类型，housing_type")
    private String type;

    /**
     * 户型，housing_layout
     */
    @ExcelProperty(value = "户型", index = 6, converter = HousingInfoConvertor.class)
    @ApiModelProperty("户型，housing_layout")
    private String layout;

    /**
     * 面积 (㎡)
     */
    @ExcelProperty(value = "面积", index = 7)
    @ApiModelProperty("面积 (㎡)")
    private Double area;

    /**
     * 朝向，housing_orientation
     */
    @ApiModelProperty("朝向，housing_orientation")
    private String orientation;

    /**
     * 所在楼层
     */
    @ApiModelProperty("所在楼层")
    private Integer floor;

    /**
     * 电梯，0无1有
     */
    @ApiModelProperty("电梯，0无1有")
    private Integer hasLift;

    /**
     * 车位，0无1有
     */
    @ApiModelProperty("车位，0无1有")
    private Integer hasPark;

    /**
     * 水，housing_water
     */
    @ApiModelProperty("水，housing_water")
    private String water;

    /**
     * 电，housing_electric
     */
    @ApiModelProperty("电，housing_electric")
    private String electric;

    /**
     * 燃气，0无1有
     */
    @ApiModelProperty("燃气，0无1有")
    private Integer gas;

    /**
     * 框架合同开始日期
     */
    @DateTimeFormat("yyyy-MM-dd HH:mm")
    @ExcelProperty(value = "框架合同开始日期", index = 8)
    @ApiModelProperty("框架合同开始日期")
    private Date frameStartTime;

    /**
     * 框架合同结束日期
     */
    @DateTimeFormat("yyyy-MM-dd HH:mm")
    @ExcelProperty(value = "框架合同结束日期", index = 9)
    @ApiModelProperty("框架合同结束日期")
    private Date frameEndTime;

    /**
     * 标准租金 (元/月)
     */
    @ExcelProperty(value = "租金", index = 13)
    @ApiModelProperty("标准租金 (元/月)")
    private Double rent;

    /**
     * 物业管理费 (元/月)
     */
    @ApiModelProperty("物业管理费 (元/月)")
    private Double fee;

    /**
     * 其他信息
     */
    @ApiModelProperty("其他信息")
    private String other;

    /**
     * 状态，housing_status
     */
    @ExcelProperty(value = "状态", index = 0, converter = HousingInfoConvertor.class )
    @ApiModelProperty("状态，housing_status")
    private String status;

    public String getTitle() {
        if (StringUtils.isEmpty(title)) {
            return address + roomNum;
        }
        return title;
    }
}
